import request from '@/utils/request'

// 申请加入社团
export function applyToClub(data) {
  return request({
    url: '/campus/application/apply',
    method: 'post',
    data: data
  })
}

// 查询当前用户负责社团的申请列表
export function listApplicationsForCurrentUser(userId) {
  return request({
    url: '/campus/application/listByCurrentUser/' + userId,
    method: 'get'
    // 不需要再传递额外的参数，因为userId已经在路径中了
  })
}

// 同意申请
export function approveApplication(id) {
  return request({
    url: '/campus/application/approve/' + id,
    method: 'post'
  })
}

// 拒绝申请
export function rejectApplication(id) {
  return request({
    url: '/campus/application/reject/' + id,
    method: 'post'
  })
}

// 查询社团申请列表
export function listApplication(query) {
  return request({
    url: '/campus/application/list',
    method: 'get',
    params: query
  })
}

// 查询社团申请详细
export function getApplication(id) {
  return request({
    url: '/campus/application/' + id,
    method: 'get'
  })
}

// 新增社团申请
export function addApplication(data) {
  return request({
    url: '/campus/application',
    method: 'post',
    data: data
  })
}

// 修改社团申请
export function updateApplication(data) {
  return request({
    url: '/campus/application',
    method: 'put',
    data: data
  })
}

// 删除社团申请
export function delApplication(id) {
  return request({
    url: '/campus/application/' + id,
    method: 'delete'
  })
}